package com.itc.bi.xxljob;

import com.alibaba.fastjson.JSONObject;
import com.itc.bi.service.DataSynApiService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @program: itc-airport-cloud
 * @description: 任务调度执行器
 * @author: songxiude
 * @create: 2024-07-05 10:17
 **/
@Component
public class DataSynXxlJob {

    @Autowired
    private DataSynApiService apiService;


    /**
     * 数据同步
     * @throws Exception
     */
    @XxlJob("DataSynHandler")
    public void dataSynJobHandler()throws Exception {
        String jobParam = XxlJobHelper.getJobParam();
        JSONObject jsonObject = JSONObject.parseObject(jobParam);
        apiService.execDataSyn(jsonObject,null);
    }


    /**
     * 指定时间通知业务逻辑端
     */
    @XxlJob("MqttDataSynHandler")
    public void mqttDataSynHandler(){
        apiService.execMqttDataUpdate();
    }

}
